package com.unipay.hosp.controller;

import com.unipay.common.result.Result;
import com.unipay.hosp.service.ScheduleService;
import com.unipay.model.hosp.Schedule;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Project: yitong_parent
 * @Author: C.yu
 * @Time: 2023-04-23 20:05:15
 * @Desc: TODO
 */
@Api(tags = "schedule接口")
@RestController
@RequestMapping("/unipay/hosp/schedule")
//@CrossOrigin
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;

    //根据hoscode 、depcode和workDate，查询Schedule详细信息
    @ApiOperation(value = "schedule详情")
    @GetMapping("/scheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(
            @PathVariable String hoscode,
            @PathVariable String depcode,
            @PathVariable String workDate   // ----类型，
    ) {
        List<Schedule> scheduleList = scheduleService.getScheduleDetail(hoscode, depcode, workDate);
        return Result.ok(scheduleList);
    }

    //根据hoscode 和 depcode ，查询 schedule规则数据
    @ApiOperation(value = "分页查询schedule")
    @GetMapping("/pageSchedule/{page}/{limit}/{hoscode}/{depcode}")
    public Result pageSchedule(
            @PathVariable long page,
            @PathVariable long limit,
            @PathVariable String hoscode,
            @PathVariable String depcode) {
        //scheduleService.selectSchedulePage(page, linit, vo);
        Map<String, Object> result = scheduleService.getPageSchedule(page, limit, hoscode, depcode);
        return Result.ok(result);
    }
    //public Map<String, Object> pageSchedule(
    //        @PathVariable long page,
    //        @PathVariable long limit,
    //        @PathVariable String hoscode,
    //        @PathVariable String depcode){
    //    //scheduleService.selectSchedulePage(page, linit, vo);
    //    Map<String, Object> result = scheduleService.getPageSchedule(page, limit, hoscode, depcode);
    //    System.out.println("map-------" + result);
    //    return result;
    //}
}
